﻿using System;

namespace Useful.MVP2
{
    public class BaseListModelT<ListT> : BaseListModel
        where ListT : class
    {
        public new ListT ListDataSource
        {
            get
            {
                return base.ListDataSource != null ? (ListT)base.ListDataSource : null;
            }
            set
            {
                base.ListDataSource = value;
            }
        }

        public override void Dispose()
        {
            if (ListDataSource != null && ListDataSource is IDisposable)
            {
                ((IDisposable)ListDataSource).Dispose();
            }
        }
    }
}
